#include "FrameFlowDataManager.h"

FrameFlowDataManager::FrameFlowDataManager(bool IsExtrapolation)
{
    this->IsExtrapolation = IsExtrapolation;
    int32 FFInputRTCount = IsExtrapolation ? 1 : 2;
    FFInputRT.AddDefaulted(FFInputRTCount);
}

FrameFlowDataManager::~FrameFlowDataManager()
{

}

void FrameFlowDataManager::SwapBuffers()
{
    CurrentIndex = FFInputRT.Num() > 1 ? (1 & (CurrentIndex + 1)) : 0;
    PrevIndex = FFInputRT.Num() > 1 ? (1 & (CurrentIndex + 1)) : 0;
}

TRefCountPtr<IPooledRenderTarget> FrameFlowDataManager::GetCurrent()
{
    return FFInputRT[CurrentIndex];
}

TRefCountPtr<IPooledRenderTarget> FrameFlowDataManager::GetPrevious()
{
    return FFInputRT[PrevIndex];
}